<div class="content">
  <h1>用户信息修改</h1>
  <% @user.password = @user.password_confirmation = nil %>
  <%= error_messages_for :user %>
  <% form_for @user , :url => admin_user_path(@user) , :html =>{:class => "form" ,:multipart => true } do |f| -%>
  
  
    <table class="table">
      <tbody>
      
        <tr class="odd">
          <td width="60px"><%= f.label User.human_attribute_name("email") %> </td>
          <td width="200px"><%= f.text_field :email ,:class => "text_field" %></td>
          <td width="60px"><%=f.label User.human_attribute_name("password")  %></td>
          <td width="200px"> <%= f.password_field :password ,:class => "text_field"  %></td>
          <td width=""> </td>
        </tr>    
        <tr class="odd">
          <td width="60px"><%= f.label User.human_attribute_name("password_confirmation")  %> </td>
          <td width="200px"> <%= f.password_field :password_confirmation ,:class => "text_field" %></td>
          <td width="60px"><%= f.label User.human_attribute_name("name")  %></td>
          <td width="200px">  <%= f.text_field :name ,:class => "text_field"  %></td>
          <td width=""> </td>
        </tr>         
        <tr class="odd">
          <td width="60px"><%=  f.label User.human_attribute_name("nickname")   %> </td>
          <td width="200px">   <%= f.text_field :nickname ,:class => "text_field" %></td>
          <td width="60px"><%=  f.label User.human_attribute_name("phone")   %></td>
          <td width="200px">  <%= f.text_field :phone  ,:class => "text_field"  %></td>
          <td width=""> </td>
        </tr>            
        <tr class="odd">
          <td width="60px"><%= f.label User.human_attribute_name("mobile")   %></td>
          <td width="200px"><%= f.text_field :mobile ,:class => "text_field" %></td>
          <td width="60px"></td>
          <td width="200px"></td>
          <td width=""> </td>
        </tr>           
        <tr class="odd">
          <td width="60px"><%=  f.label User.human_attribute_name("address") %></td>
          <td width="260px" colspan="2">
            <%= select_province_city("user",'province_id')%>
            <%= render :partial=>"shared/city_select" , :locals=>{:model=>'user' , :cities=>@cities ,:options=>{} ,:html_options=>{}} %>
            <%= render :partial=>"shared/district_select" , :locals=>{:model=>'user' , :districts=>@districts ,:options=>{} ,:html_options=>{}} %>
          </td>
          <td width="200px"></td>
          <td width=""> </td>
        </tr>
        <tr class="odd">
          <td width="60px"><%=  f.label User.human_attribute_name("address") %></td>
          <td width="200px"><%= f.text_field :address  ,:class => "text_field"  %></td>
          <td width="260px" colspan="2"> </td>
          <td width=""> </td>
        </tr>
        <tr class="odd">
          <td width="60px"><%=  f.label User.human_attribute_name("introduction")   %></td>
          <td width="200px">  <%= f.text_field :introduction %></td>
          <td width="260px" colspan="2"> </td>
          <td width=""> </td>
        </tr>
        <tr class="odd">
          <td width="60px"><%=  '角色'  %></td>
          <td width="200px"> <%Role.all.each do |role|%>
              <%= check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role) %>
              <%= role.name %>
            <%end%></td>
          <td width="260px" colspan="2"> </td>
          <td width=""> </td>
        </tr>
        <tr class="odd">
          <td width="60px">图标</td>
          <td width="200px"><%= f.file_field :image %></td>
          <td width="260px" colspan="2"> </td>
          <td width=""><%= image_tag @user.image.url, :size => "200x200" %> </td>
        </tr>
        <tr class="odd">
          <td width="60px"></td>
          <td width="200px"></td>
          <td width="260px" colspan="2"> <%= submit_tag '提交' %></td>
          <td width=""> </td>
        </tr>
      </tbody>
    </table>
  <% end -%>
  
  
  
</div>